import requests
import json
from server.chat_api import chat_with_openai_rq,chat_with_openai_lc

url = "http://localhost:8002/chat/chat"
#url = "http://localhost:8002/chat/chatlc"


data = {
    "query": "你好，我是张宇杰",
    "temperature": 0.5
}
data = {
    "query": "我叫什么来着？",
    "history": [{"role": "user", "content": "你好，我是张宇杰"},
                {"role": "assistant", "content": "你好,张宇杰!请问有什么需要帮助的吗?"}],
    "temperature": 0.5
}

#response = chat_with_openai_rq(**data)
#response = chat_with_openai_lc(**data)
#json.loads(response.json())



response = requests.post(url, json=data)
# response = requests.post(url, data=json.dumps(data))

if response.status_code == 200:
    print("调用成功，返回结果：", response.json())
else:
    print("调用失败，状态码：", response.status_code)
    print("错误信息：", response.text)
